import java.util.Arrays;
import java.util.Iterator;

public class 去重 {
	public static void main(String[] args) {
		int[] arr = { 1, 3, 0, 6, 2, 0, 2, 0, 1, 7, 2, 7 };
		System.out.println(Arrays.toString(arr));
		arr = quChong(arr);
		System.out.println(Arrays.toString(arr));
	}

	static int[] quChong(int[] arr) {
		int[] newArr = new int[arr.length];
		int index = 0;
		//保证拿出所有的元素
		for (int i = 0; i < arr.length; i++) {
			boolean flag = true;
			for (int j = 0; j < index; j++) {
				if(arr[i] == newArr[j]) {
					flag = false;
					break;
				}
			}
			if (flag) {
				newArr[index++] = arr[i];
			}
		}
		
		return Arrays.copyOfRange(newArr, 0, index);
	}

	// 1, 3, 4, 6, 2, 6, 2, 6, 1, 7, 2, 7
	// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

}
